/*   1:    */ package org.jetbrains.jps.model.java.impl;
/*   2:    */ 
/*   3:    */

import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.Nullable;

import java.io.File;
import java.io.FileFilter;
import java.io.IOException;
import java.util.List;
import java.util.Set;

/*   4:    */
/*   5:    */
/*   6:    */
/*   7:    */
/*   8:    */
/*   9:    */
/*  10:    */
/*  11:    */
/*  12:    */ 
/*  13:    */ public class JavaSdkUtil
/*  14:    */ {
/*  15:    */   public static List<File> getJdkClassesRoots(File paramFile, boolean paramBoolean)
/*  16:    */   {
/*  17: 34 */     FileFilter local1 = new FileFilter()
/*  18:    */     {
/*  19:    */       public boolean accept(File paramAnonymousFile)
/*  20:    */       {
/*  21: 38 */         return (!paramAnonymousFile.isDirectory()) && (paramAnonymousFile.getName().endsWith(".jar"));
/*  22:    */       }
/*  23:    */     };
/*  24:    */     File[] arrayOfFile1;
/*  25: 43 */     if ((SystemInfo.isMac) && (!paramFile.getName().startsWith("mockJDK")))
/*  26:    */     {
/*  27: 44 */       localObject1 = new File(paramFile, "jre/lib/rt.jar");
/*  28:    */       File localFile1;
/*  29:    */       File localFile2;
/*  30: 45 */       if ((((File)localObject1).exists()) && (!((File)localObject1).isDirectory()))
/*  31:    */       {
/*  32: 46 */         localObject2 = new File(paramFile, "lib");
/*  33: 47 */         localObject3 = ((File)localObject1).getParentFile();
/*  34: 48 */         localFile1 = new File(((File)localObject1).getParentFile(), "ext");
/*  35: 49 */         localFile2 = new File((File)localObject2, "endorsed");
/*  36: 50 */         arrayOfFile1 = new File[] { localFile2, localObject2, localObject3, localFile1 };
/*  37:    */       }
/*  38:    */       else
/*  39:    */       {
/*  40: 53 */         localObject2 = new File(paramFile, "lib");
/*  41: 54 */         localObject3 = new File(paramFile, "../Classes");
/*  42: 55 */         localFile1 = new File((File)localObject2, "ext");
/*  43: 56 */         localFile2 = new File((File)localObject2, "endorsed");
/*  44: 57 */         arrayOfFile1 = new File[] { localFile2, localObject2, localObject3, localFile1 };
/*  45:    */       }
/*  46:    */     }
/*  47:    */     else
/*  48:    */     {
/*  49: 61 */       localObject1 = paramBoolean ? new File(paramFile, "lib") : new File(paramFile, "jre/lib");
/*  50: 62 */       localObject2 = new File((File)localObject1, "ext");
/*  51: 63 */       localObject3 = new File((File)localObject1, "endorsed");
/*  52: 64 */       arrayOfFile1 = new File[] { localObject3, localObject1, localObject2 };
/*  53:    */     }
/*  54: 67 */     Object localObject1 = ContainerUtil.newTroveSet(FileUtil.PATH_HASHING_STRATEGY);
/*  55: 68 */     Object localObject2 = ContainerUtil.newArrayList();
/*  56:    */     File[] arrayOfFile2;
/*  57: 69 */     for (Object localObject5 : arrayOfFile1) {
/*  58: 70 */       if ((localObject5 != null) && (localObject5.isDirectory()))
/*  59:    */       {
/*  60: 71 */         arrayOfFile2 = localObject5.listFiles(local1);
/*  61: 72 */         for (File localFile3 : arrayOfFile2)
/*  62:    */         {
/*  63: 73 */           String str1 = localFile3.getName();
/*  64: 74 */           if ((!str1.equals("alt-rt.jar")) && (!str1.equals("alt-string.jar")))
/*  65:    */           {
/*  66: 77 */             String str2 = a(localFile3);
/*  67: 78 */             if ((str2 != null) && (((Set)localObject1).add(str2))) {
/*  68: 81 */               ((List)localObject2).add(localFile3);
/*  69:    */             }
/*  70:    */           }
/*  71:    */         }
/*  72:    */       }
/*  73:    */     }
/*  74: 86 */     Object localObject3 = { "jre/bin/default/jclSC170/vm.jar", "jre/lib/i386/default/jclSC170/vm.jar", "jre/lib/amd64/default/jclSC170/vm.jar", "jre/bin/default/jclSC160/vm.jar", "jre/lib/i386/default/jclSC160/vm.jar", "jre/lib/amd64/default/jclSC160/vm.jar", "lib/classes.zip" };
/*  75: 95 */     for (arrayOfFile2 : localObject3)
/*  76:    */     {
/*  77: 96 */       ??? = new File(paramFile, arrayOfFile2);
/*  78: 97 */       if (((File)???).isFile()) {
/*  79: 98 */         ((List)localObject2).add(???);
/*  80:    */       }
/*  81:    */     }
/*  82:102 */     ??? = new File(paramFile, "classes");
/*  83:103 */     if ((((List)localObject2).isEmpty()) && (((File)???).isDirectory())) {
/*  84:104 */       ((List)localObject2).add(???);
/*  85:    */     }
/*  86:107 */     return localObject2;
/*  87:    */   }
/*  88:    */   
/*  89:    */   @Nullable
/*  90:    */   private static String a(File paramFile)
/*  91:    */   {
/*  92:    */     try
/*  93:    */     {
/*  94:113 */       return paramFile.getCanonicalPath();
/*  95:    */     }
/*  96:    */     catch (IOException localIOException) {}
/*  97:116 */     return null;
/*  98:    */   }
/*  99:    */ }



/* Location:           E:\idea\

 * Qualified Name:     org.jetbrains.jps.model.java.impl.JavaSdkUtil

 * JD-Core Version:    0.7.0.1

 */